package com.hgkj.system.controller;

import com.hgkj.common.core.domain.ApiResult;
import com.hgkj.system.domain.SysDictData;
import com.hgkj.system.domain.dto.request.DictGetRequest;
import com.hgkj.system.service.SysDictDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.validation.Valid;
import java.util.List;

/**
 * 数据字典管理
 * @author hgkj
 */
@Validated
@RestController
@RequestMapping("/system/dict")
public class SysDictDataController {

    @Autowired
    private SysDictDataService dictDataService;

    @GetMapping
    public ApiResult getDictData(@Valid DictGetRequest request){
        List<SysDictData> dictData = dictDataService.getDictData(request.getDictType());
        return ApiResult.success(dictData);
    }
}
